home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / ubmalm.zip / confrat.ub < prev    next >
Text File  |  1990-08-22  |  445b  |  12 lines

  1.    10   *Confrat(&C(),Leng,&A,&B)
  2.    15   ' Converts a finite continued fraction to a rational a/b.
  3.    20   ' C() is an input parameter, passed by reference for efficiency.
  4.    30   ' Modeled on the Pascal version.
  5.    40   ' 3 May 1990
  6.    50   local H1=0,H2=1,K1=1,K2=0,Te,I
  7.    60   for I=0 to Leng
  8.    70   Te=H1+H2*C(I):H1=H2:H2=Te
  9.    80   Te=K1+K2*C(I):K1=K2:K2=Te
  10.    90   next I
  11.   100   A=H2:B=K2:return ' End of Subroutine Confrat
  12.